miRTalk tutorial
Pre-processing
rev_gene()
Revise genes with rev_gene(). For scRNA-seq data, we
suggest to revise the gene symbols with rev_gene().
geneinfo is the system data.frame containing the
information of human and mouse from NCBI gene(updated in June. 19,
2022). To use your own geneinfo data.frame, please refer to
demo_geneinfo() to build a new one, e.g., rat, zebrafish,
Drosophila, C. elegans, etc.
Parameters of rev_gene() see below:
dataA data.frame or matrix or dgCMatrixdata_typeA character to define the type ofdata, select ‘count’ for the data matrix, ‘mir_info’ for the mir_info data.frame, ‘mir2tar’ for the mir2tar data.frame, ‘pathways’ for the pathways data.frame, ‘gene2go’ for the gene2go data.framespeciesSpecies of the data.’Human’, ‘Mouse’ or ‘Rat’geneinfoA data.frame of the system data containing gene symbols of ‘Human’, ‘Mouse’ and ‘Rat’ updated on June 19, 2022 for revising gene symbols
library(miRTalk)
#> 载入需要的程辑包:doParallel
#> Warning: 程辑包'doParallel'是用R版本4.1.3 来建造的
#> 载入需要的程辑包:foreach
#> 载入需要的程辑包:iterators
#> 载入需要的程辑包:parallel
#> Warning: replacing previous import 'Seurat::JS' by 'networkD3::JS' when loading
#> 'miRTalk'
load(paste0(system.file(package = "miRTalk"), "/extdata/example.rda"))
# demo_geneinfo
demo_geneinfo()
#> symbol synonyms species
#> 1 A1BG A1B Human
#> 2 A1BG ABG Human
#> 3 A2MP1 A2MP Human
#> 4 Aco1 Aco Mouse
#> 5 Alb1 Alb Rat
# demo_sc_data
demo_sc_data()
#> 6 x 6 sparse Matrix of class "dgCMatrix"
#> cell1 cell2 cell3 cell4 cell5 cell6
#> A1BG . 18 . . . 39
#> A2M . . 28 . . 7
#> A2MP . . 5 . 26 .
#> NAT1 . . 30 . . 26
#> NAT2 . 29 13 42 25 .
#> NATP 14 . 15 19 38 .
# revise gene symbols
sc_data <- rev_gene(data = sc_data,data_type = "count",species = "Human",geneinfo = geneinfo)Processing
create_miRTalk()
Create miRTalk object with create_miRTalk(). Users need
to provide the raw count data and the cell type for
create_miRTalk(). miRTalk will use
NormalizeData() in Seurat to normalize data by
default. If your data has been normalized by other methods, you can set
the parameter if_normalize = FALSE
Parameters of create_miRTalk() see below: -
sc_data mA data.frame or matrix or dgCMatrix containing raw
counts of single-cell RNA-seq data - sc_celltype A
character containing the cell type of the single-cell RNA-seq data -
species A character meaning species of the single-cell
transcriptomics data. “Human”, “Mouse”, “Rat” -
if_normalize Normalize sc_data with Seurat
LogNormalize()
obj <- create_miRTalk(sc_data = sc_data, sc_celltype = sc_celltype, species = "Human")
obj
#> An object of class miRTalk
#> 0 EV-derived miRNA-target interactions
# If your data has been normalized by other methods, you can set the parameter `if_normalize = FALSE`
# obj <- create_miRTalk(sc_data = sc_data, sc_celltype = sc_celltype, species = "Human", if_normalize = FALSE)find_miRNA()
Find expressed miRNAs among all cells with find_miRNA().
Users need to provided a EV-derived miRNA database for
find_miRNA(). mir_info is the system
data.frame containing information of EV-derived miRNA of “Human”,
“Mouse”, and “Rat”. To use your own mir_info data.frame, please refer to
demo_mir_info() to build a new one, e.g., zebrafish,
Drosophila, C. elegans, etc.
Parameters of find_miRNA() see below: -
object miRTalk object after create_miRTalk() -
mir_info A data.frame of the system data containing
information of EV-derived miRNA of “Human”, “Mouse”, and “Rat”
# demo_mir_info
demo_mir_info()
#> miRNA miRNA_mature gene species
#> 1 hsa-miR-1 hsa-miR-1-5p MIR1-1 Human
#> 2 hsa-miR-1 hsa-miR-1-5p MIR1-2 Human
#> 3 hsa-miR-1 hsa-miR-1-3p MIR1-1 Human
#> 4 hsa-miR-1 hsa-miR-1-3p MIR1-2 Human
#> 5 mmu-miR-105 mmu-miR-105 Mir105 Mouse
#> 6 rno-miR-106b rno-miR-106b-5p Mir106b Rat
# find highly expressed LR pairs
obj <- find_miRNA(object = obj, mir_info = mir_info)find_hvtg()
Find highly variable target genes with DEGs and HVGs
find_hvtg(). miRTalk uses the top 3000 HVGs and DEGs for
each cell types with Seurat methods. The result is a
character stored obj@data$var_genes. Users can use their
own methods to find Find highly variable target genes and replace
them
Parameters of find_hvtg() see below: -
object miRTalk object after create_miRTalk() -
pvalue Cutoff of p value. Default is 0.05 -
log2fc log2 fold change for identifying the highly
expressed genes in each cell type. Default is 0.5 -
min_cell_num Min cell number for each cell type. Default is
10 - nfeatures Number of features to select as top variable
features. Default is 3000
# find highly variable target genes
obj <- find_hvtg(object = obj)
# the result is a character
var_genes <- obj@data$var_genes
str(var_genes)
#> chr [1:3377] "MGP" "LUM" "DCD" "DCN" "IGKV2D-28" "IGKV3-11" "SPINK1" ...
# if your have your own result, you can replace them with the following code
# object@data$var_genes <- your_own_var_genesfind_miRTalk()
Infer cell-cell communications mediated by EV-derived miRNAs from
senders to receivers with find_miRTalk(). miRTalk uses the
curated mir2tar database containing EV-derived miRNA-target
interactions. To use your own mir2tar data.frame, please refer to
demo_mir2tar() to build a new one, e.g., zebrafish,
Drosophila, C. elegans, etc. The result is a character stored
obj@cci. Users can use get_miRTalk_cci() to
get simple results of miRNA-target interactions.
Parameters of find_miRTalk() see below: -
object miRTalk object after find_miRNA() and
find_hvtg() - mir2tar A data.frame of the
system data containing relationship of miRNA and its target genes for
“Human”, “Mouse”, “Rat” - min_cell_num Min cell number for
each cell type and expressed miRNA. Default is 10 - pvalue
Cutoff of p value. Default is 0.05 - resolution Correct to
precursor or mature miRNAs. Use ‘precursor’ or ‘mature’. Default is
‘mature’ - min_percent Min percent of expressed cells for
target genes of miRNA. Default is 0.05 - if_doParallel Use
doParallel. Default is TRUE - use_n_cores umber of CPU
cores to use. Default is 4
# demo_mir2tar
demo_mir2tar()
#> miRNA miRNA_mature target_gene species
#> 1 hsa-miR-1 hsa-miR-1-5p BDNF Human
#> 2 hsa-miR-1 hsa-miR-1-3p RBM28 Human
#> 3 mmu-miR-105 mmu-miR-105 Abl2 Mouse
#> 4 rno-miR-106b rno-miR-106b-5p Mcl1 Rat
# infer cell-cell communications mediated by EV-derived miRNAs from senders to receivers
obj <- find_miRTalk(object = obj, mir2tar = mir2tar)
obj
#> An object of class miRTalk
#> 2185 EV-derived miRNA-target interactions
# the result is a data.frame
cci <- obj@cci
str(cci)
#> 'data.frame': 2185 obs. of 17 variables:
#> $ celltype_sender : chr "Bcell" "Bcell" "Bcell" "Bcell" ...
#> $ celltype_receiver : chr "Bcell" "Bcell" "Bcell" "Bcell" ...
#> $ miRNA : chr "hsa-miR-4426" "hsa-miR-29b-3p" "hsa-miR-29b-3p" "hsa-miR-29b-3p" ...
#> $ miR_gene : chr "MIR4426" "MIR29B1" "MIR29B1" "MIR29B1" ...
#> $ percent_sender : num 0.19 0.231 0.231 0.231 0.231 ...
#> $ percent_receiver : num 0.19 0.231 0.231 0.231 0.231 ...
#> $ miRNA_activity : num 0.429 0.481 0.481 0.481 0.481 ...
#> $ target_gene : chr "PPIC" "CLDN1" "EREG" "TGFB3" ...
#> $ target_gene_activity : num 5.81e-03 3.45e-04 1.03e-04 3.43e-04 4.85e-05 ...
#> $ target_gene_mean_exp : num 0.02822 0.001677 0.000501 0.001667 0.000235 ...
#> $ target_gene_mean_exp_other: num 0.187 0.1058 0.1496 0.1191 0.0943 ...
#> $ target_gene_percent : num 0.0964 0.0843 0.0964 0.0723 0.0843 ...
#> $ target_gene_percent_other : num 0.403 0.208 0.211 0.303 0.164 ...
#> $ pvalue : num 1.58e-08 2.63e-03 3.73e-03 1.85e-06 1.81e-02 ...
#> $ sig : chr "YES" "YES" "YES" "YES" ...
#> $ prob : num 0.469 0.466 0.466 0.466 0.466 ...
#> $ score : num 0.426 0.48 0.481 0.48 0.481 ...
# get simple results of miRNA-target interactions
obj_cci <- get_miRTalk_cci(obj)
str(obj_cci)
#> 'data.frame': 2083 obs. of 9 variables:
#> $ celltype_sender : chr "Bcell" "Bcell" "Bcell" "Bcell" ...
#> $ celltype_receiver : chr "Bcell" "Bcell" "Bcell" "Bcell" ...
#> $ miRNA : chr "hsa-miR-4426" "hsa-miR-29b-3p" "hsa-miR-29b-3p" "hsa-miR-29b-3p" ...
#> $ miR_gene : chr "MIR4426" "MIR29B1" "MIR29B1" "MIR29B1" ...
#> $ miRNA_activity : num 0.429 0.481 0.481 0.481 0.481 ...
#> $ target_gene : chr "PPIC" "CLDN1" "EREG" "TGFB3" ...
#> $ target_gene_activity: num 5.81e-03 3.45e-04 1.03e-04 3.43e-04 4.85e-05 ...
#> $ prob : num 0.469 0.466 0.466 0.466 0.466 ...
#> $ score : num 0.426 0.48 0.481 0.48 0.481 ...Visualization
plot_miRTalk_chord()
Parameters of plot_miRTalk_chord() see below:
objectmiRTalk object afterfind_miRTalk()celltypewhich cell types to plot by order. Default is to plot all cell typescelltype_colorColors for the cell types, whose length must be equal tocelltypemiRNAwhich miRNAs to use. Default is to plot all inferred miRNAsedge_colorColors for the edges from the sender cell type, whose length must be equal to celltypeedge_typeTypes for the edges from the sender cell type. Default is “big.arrow”. “ellipse” for ellipse, “triangle” for triangle, “curved” for curved. Details seecirclize::chordDiagram()show_typewhich type of miRNAs to show, “number”, “activity”, or “score” for sum of inferred miRNAs number and activity, respectively, or “prob” for max probability. Default is “number”if_show_autocrineWhether to show autocrine. Default is FALSEtext_sizeSize of text labels. Default is 1.5y_scaley_scale to adjust the text. Default is 0.1...parameters pass tocirclize::chordDiagram(), e.g.,link.arr.width,link.arr.length,link.arr.col
plot_miRTalk_chord(object = obj)plot_miRTalk_circle()
Parameters of plot_miRTalk_circle() see below:
objectmiRTalk object afterfind_miRTalk()celltypewhich cell types to plot. Default is to plot all cell typesmiRNAwhich miRNAs to use. Default is to plot all inferred miRNAscelltype_colorColors for the cell types, whose length must be equal tocelltypeedge_colorColors for the edges from the sender cell type, whose length must be equal tocelltypeedge_typeTypes for the edges. “fan” by default, “link”, “hive”show_typewhich type of miRNAs to show, “number”, “activity”, or “score” for sum of inferred miRNAs number and activity, respectively, or “prob” for max probability. Default is “number”if_show_autocrineWhether to show autocrine. Default isFALSEedge_alphaTransparency of edge. Default is 0.5node_sizeSize of node. Default is 10text_sizeSize of text. Default is 5
plot_miRTalk_circle(object = obj)plot_miRTalk_circle_simple()
To show one or more senders or receivers by retaining all cell
types, users can use plot_miRTalk_circle_simple() for
plotting.
Parameters of plot_miRTalk_circle_simple() see
below:
objectmiRTalk object afterfind_miRTalk()celltypewhich cell types to plot. one or more cell typescelltype_dirwhich direction to plot, “sender” or “receiver”. Default is as “sender”miRNAwhich miRNAs to use. Default is to plot all inferred miRNAscelltype_colorColors for the cell types, whose length must be equal tocelltypeedge_colorColors for the edges from the sender cell type, whose length must be equal tocelltypeedge_typeTypes for the edges. “fan” by default, “link”, “hive”show_typewhich type of miRNAs to show, “number”, “activity”, or “score” for sum of inferred miRNAs number and activity, respectively, or “prob” for max probability. Default is “number”if_show_autocrineWhether to show autocrine. Default isFALSEedge_alphaTransparency of edge. Default is 0.5node_sizeSize of node. Default is 10text_sizeSize of text. Default is 5
# as sender
plot_miRTalk_circle_simple(object = obj, celltype = "Tumor", celltype_dir = "sender")
# as receiver
plot_miRTalk_circle_simple(object = obj, celltype = "Tumor", celltype_dir = "reciver")plot_miRTalk_heatmap()
Parameters of plot_miRTalk_heatmap() see below:
objectmiRTalk object afterfind_miRTalk()celltypewhich cell types to plot. Default is to plot all cell typesmiRNAwhich miRNAs to use. Default is to plot all inferred miRNAsshow_typewhich type of miRNAs to show, “number”, “activity”, or “score” for sum of inferred miRNAs number and activity, respectively, or “prob” for max probability. Default is “number”text_sizeSize of text labels. Default is 10viridis_optionoption inviridis::scale_color_viridis, can be “A”, “B”, “C”, “D”, “E”, “F”, “G”, “H”. Default is “D”...parameters pass toheatmaply::heatmaply, e.g., grid_color, grid_width
plot_miRTalk_heatmap(object = obj)plot_miRTalk_sankey()
Parameters of plot_miRTalk_sankey() see below:
objectmiRTalk object afterfind_miRTalk()celltypewhich cell types to plot by order. Default is to plot all cell typesmiRNAwhich miRNAs to use. Default is to plot all inferred miRNAscelltype_colorColors for the cell types, whose length must be equal tocelltypeedge_colorColors for the edges from the sender cell type, whose length must be equal tocelltype, Or use “NO” to cancel itshow_typewhich type of miRNAs to show, “number”, “activity”, or “score” for sum of inferred miRNAs number and activity, respectively, or “prob” for max probability. Default is “number”if_show_autocrineWhether to show autocrine. Default is FALSEedge_alphaTransparency of edge. Default is 0.5node_sizeSize of node. Default is 40text_sizeSize of text. Default is 15node_padSize of node padding. Numeric essentially influences the width height. Default is 20...parameters pass tonetworkD3::sankeyNetwork
plot_miRTalk_sankey(object = obj)plot_miR_heatmap()
Parameters of plot_miR_heatmap()see below:
objectmiRTalk object afterfind_miRTalk()celltypewhich cell types to plot. Default is to plot all cell typesmiRNAwhich miRNAs to plot. Default is to plot all inferred miRNAstext_sizeSize of text labels. Default is 10if_horizontalWhether to plot with the horizontal direction. Default isTRUEviridis_optionoption inviridis::scale_color_viridis, can be “A”, “B”, “C”, “D”, “E”, “F”, “G”, “H”. Default is “D”....parameters pass toheatmaply::heatmaply, e.g., grid_color, grid_width
plot_miR_heatmap(object = obj)plot_miR_bubble()
Parameters of plot_miR_bubble() see below:
objectmiRTalk object afterfind_miRTalk()celltypewhich cell types to plot. Default is to plot all cell typesmiRNAwhich miRNAs to plot. Default is to plot all inferred miRNAsif_show_autocrineWhether to show autocrine. Default isFALSEif_horizontalWhether to plot with the horizontal direction. Default isTRUEviridis_optionoption inviridis::scale_color_viridis, can be “A”, “B”, “C”, “D”, “E”, “F”, “G”, “H”. Default is “D”.
plot_miR_bubble(object = obj)plot_miR2tar_chord()
Parameters of plot_miR2tar_chord() see below:
objectmiRTalk object afterfind_miRTalk()celltype_senderName of celltype_sender. One or more cell typescelltype_receiverName of celltype_receiver. One or more cell typescelltype_colorColors for the celltype_sender nodes and celltype_receiver nodes, or use “NO” to make it simplemiRNAwhich miRNAs to use. Default is to plot all inferred miRNAsedge_colorColors for the edges from the sender cell typeedge_typeTypes for the edges from the sender cell type. Default is “circle”, “big.arrow” for big arrow, “triangle” for triangle, “ellipse” for ellipse, “curved” for curved. Details seecirclize::chordDiagramshow_typewhich type of miRNAs to show, “prob” or “score” for inferred miRNAs-target interactions. Default is “prob”text_sizeSize of text labels. Default is 0.5y_scaley_scale to adjust the text. Default is 1...parameters pass tocirclize::chordDiagram, e.g.,link.arr.width,link.arr.length,link.arr.col
plot_miR2tar_chord(obj, celltype_sender = "Tumor", celltype_receiver = "Stromal")plot_miR2tar_circle()
Parameters of plot_miR2tar_circle() see below:
objectmiRTalk object afterfind_miRTalk()celltype_senderName of celltype_sender. One or more cell typescelltype_receiverName of celltype_receiver. One or more cell typescelltype_colorColors for the celltype_sender nodes and celltype_receiver nodes, or use “NO” to make it simplemiRNAwhich miRNAs to use. Default is to plot all inferred miRNAsedge_colorColors for the edges from the sender cell typetext_sizeSize of text labels. Default is 3edge_widthy_scale to adjust the text. Default is 0.5
plot_miR2tar_circle(obj, celltype_sender = "Tumor", celltype_receiver = "Stromal")
plot_miR2tar_circle(obj, celltype_sender = "Tumor", celltype_receiver = "Stromal", celltype_color = "NO")plot_miR2tar_heatmap()
Parameters of plot_miR2tar_heatmap() see below:
objectmiRTalk object afterfind_miRTalk()celltype_senderName of celltype_sender. One or more cell typescelltype_receiverName of celltype_receiver. One or more cell typesmiRNAwhich miRNAs to use. Default is to plot all inferred miRNAsshow_typewhich type of miRNAs to show, “prob” or “score” for inferred miRNAs-target interactions. Default is “prob”text_sizeSize of text labels. Default is 3if_horizontalWhether to plot with the horizontal direction. Default isTRUEviridis_optionoption inviridis::scale_color_viridis, can be “A”, “B”, “C”, “D”, “E”, “F”, “G”, “H”. Default is “D”....parameters pass toheatmaply::heatmaply, e.g., grid_color
plot_miR2tar_heatmap(obj, celltype_sender = "Tumor", celltype_receiver = "Stromal", grid_color = "black")Note
To plot the sparse expression of miRNA genes in scRNA-seq, you can
use the Nebulosa::plot_density()
Nebulosa::plot_density(object = obj_seurat, features = "MIR24-2")
sessionInfo()
#> R version 4.1.1 (2021-08-10)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 19045)
#>
#> Matrix products: default
#>
#> locale:
#> [1] LC_COLLATE=Chinese (Simplified)_China.936
#> [2] LC_CTYPE=Chinese (Simplified)_China.936
#> [3] LC_MONETARY=Chinese (Simplified)_China.936
#> [4] LC_NUMERIC=C
#> [5] LC_TIME=Chinese (Simplified)_China.936
#>
#> attached base packages:
#> [1] parallel stats graphics grDevices utils datasets methods
#> [8] base
#>
#> other attached packages:
#> [1] miRTalk_1.0 doParallel_1.0.17 iterators_1.0.13 foreach_1.5.1
#>
#> loaded via a namespace (and not attached):
#> [1] circlize_0.4.13 plyr_1.8.6 igraph_1.2.7
#> [4] lazyeval_0.2.2 sp_1.4-5 splines_4.1.1
#> [7] crosstalk_1.2.0 listenv_0.8.0 scattermore_0.7
#> [10] ggplot2_3.3.6 digest_0.6.28 ca_0.71.1
#> [13] htmltools_0.5.2 viridis_0.6.2 fansi_0.5.0
#> [16] magrittr_2.0.1 tensor_1.5 cluster_2.1.2
#> [19] ROCR_1.0-11 limma_3.50.0 globals_0.14.0
#> [22] graphlayouts_0.7.1 matrixStats_0.61.0 spatstat.sparse_3.0-0
#> [25] prettyunits_1.1.1 rmdformats_1.0.3 colorspace_2.0-2
#> [28] ggrepel_0.9.1 xfun_0.30 dplyr_1.0.7
#> [31] crayon_1.4.2 jsonlite_1.7.2 progressr_0.9.0
#> [34] spatstat.data_3.0-0 survival_3.2-11 zoo_1.8-9
#> [37] glue_1.4.2 polyclip_1.10-0 registry_0.5-1
#> [40] gtable_0.3.0 webshot_0.5.4 leiden_0.3.9
#> [43] future.apply_1.8.1 shape_1.4.6 abind_1.4-5
#> [46] scales_1.1.1 pheatmap_1.0.12 DBI_1.1.1
#> [49] miniUI_0.1.1.1 Rcpp_1.0.7 progress_1.2.2
#> [52] viridisLite_0.4.0 xtable_1.8-4 reticulate_1.22
#> [55] spatstat.core_2.3-0 datawizard_0.6.2 htmlwidgets_1.5.4
#> [58] httr_1.4.2 RColorBrewer_1.1-2 ellipsis_0.3.2
#> [61] Seurat_4.1.1 ica_1.0-2 pkgconfig_2.0.3
#> [64] farver_2.1.0 sass_0.4.0 uwot_0.1.10
#> [67] deldir_1.0-6 utf8_1.2.2 labeling_0.4.2
#> [70] tidyselect_1.1.1 rlang_0.4.12 reshape2_1.4.4
#> [73] later_1.3.0 munsell_0.5.0 tools_4.1.1
#> [76] generics_0.1.1 ggridges_0.5.3 evaluate_0.14
#> [79] stringr_1.4.0 fastmap_1.1.0 heatmaply_1.4.0
#> [82] yaml_2.2.1 goftest_1.2-3 knitr_1.36
#> [85] fitdistrplus_1.1-6 tidygraph_1.2.0 purrr_0.3.4
#> [88] RANN_2.6.1 dendextend_1.16.0 ggraph_2.0.5
#> [91] pbapply_1.5-0 future_1.23.0 nlme_3.1-152
#> [94] mime_0.12 correlation_0.8.3 compiler_4.1.1
#> [97] plotly_4.10.0 png_0.1-7 spatstat.utils_3.0-1
#> [100] tibble_3.1.5 tweenr_1.0.2 bslib_0.3.1
#> [103] stringi_1.7.5 highr_0.9 rgeos_0.5-9
#> [106] lattice_0.20-44 Matrix_1.3-4 vctrs_0.3.8
#> [109] pillar_1.6.4 lifecycle_1.0.1 networkD3_0.4
#> [112] spatstat.geom_3.0-3 lmtest_0.9-38 jquerylib_0.1.4
#> [115] GlobalOptions_0.1.2 RcppAnnoy_0.0.19 insight_0.18.5
#> [118] data.table_1.14.2 cowplot_1.1.1 irlba_2.3.3
#> [121] seriation_1.4.0 httpuv_1.6.3 patchwork_1.1.1
#> [124] R6_2.5.1 bookdown_0.25 promises_1.2.0.1
#> [127] TSP_1.2-1 KernSmooth_2.23-20 gridExtra_2.3
#> [130] parallelly_1.28.1 codetools_0.2-18 MASS_7.3-54
#> [133] assertthat_0.2.1 SeuratObject_4.1.0 sctransform_0.3.3
#> [136] bayestestR_0.13.0 hms_1.1.1 mgcv_1.8-36
#> [139] grid_4.1.1 rpart_4.1-15 tidyr_1.1.4
#> [142] rmarkdown_2.13 Rtsne_0.15 ggforce_0.3.3
#> [145] shiny_1.7.1